package com.qincji.webviewbrowser;

import com.jcodecraeer.xrecyclerview.XRecyclerView;
import ohos.agp.components.Component;
import ohos.agp.components.ComponentContainer;
import ohos.agp.components.Image;
import ohos.agp.components.Text;
import ohos.agp.components.element.ElementScatter;
import ohos.app.Context;

import java.util.List;

/**
 * 描述：
 * 作者：qincji on 2021/7/8 17:23
 * 起于：https://zqxq.club
 * 邮箱：xhunmon@126.com
 */
public class MoreAdapter<T> extends XRecyclerView.RecyclerAdapter<T> {

    private final static String TAG = "MoreAdapter";

    private Context context;

    public MoreAdapter(Context context, List data) {
        super(context, data, ResourceTable.Layout_common_more_item);
        this.context = context;
    }

    @Override
    public List getData() {
        return super.getData();
    }

    @Override
    public int getCount() {
        return super.getCount();
    }

    @Override
    public T getItem(int position) {
        return super.getItem(position);
    }

    @Override
    public long getItemId(int position) {
        return super.getItemId(position);
    }

    @Override
    public Component getComponent(int position, Component convertComponent, ComponentContainer parent) {
        return super.getComponent(position, convertComponent, parent);
    }

    @Override
    public void setNumColumns(int numColumns) {
        super.setNumColumns(numColumns);
    }

    @Override
    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
        super.setOnItemClickListener(onItemClickListener);
    }

    @Override
    public void bind(ViewHolder holder, T t, int position) {
        MoreModel model = (MoreModel) t;
        holder.<Text>getView(ResourceTable.Id_name).setText(model.getName());
        holder.<Image>getView(ResourceTable.Id_img).setImageElement(ElementScatter.getInstance(context).parse(model.getImgId()));
    }
}